#!/bin/sh

# Преобразование колонки значений в таблицу по 8 значений в строке
# вида: ".dw 0xFCB5,0xFCBA,0xFCBD,0xFCC1,0xFCC5,0xFCC8,0xFCCD,0xFCD0"
# или:  ".dи 0xFC,0xFC,0xBD,0xF1,0xFC,0xC8,0xFD,0xFD"

out=`echo $1 | sed s/txt/hex/`

cat $1 | sed 's/^/0x/g' | tr "\n" "," | fold -w 56 | sed 's/^/.dw /g; s/,$//g' > ${out}

#cat $1 | sed 's/^/0x/g' | tr "\n" "," | fold -w 60 | sed 's/^/.db /g; s/,$//g' > $2
